<template>
	<view class="history" >
		<image src="../../static/shizhong.png" mode="widthFix" ></image>
		<text>浏览历史</text>
		<view class="loseData" v-if="historyList.length === 0">
			<image src="../../static/zwsj.png" mode="aspectFit"></image>
		</view>
		<NewsCell v-for="data in historyList" :key="data.id" :data="data" :isHistory="true"></NewsCell>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				historyList:[]
			}
		},
		onShow() {
			this.getHistoryList()
		},
		
		methods: {
			getHistoryList(){
				uni.getStorage({
					key:"history_list",
					success: (res) => {
						this.historyList = res.data
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.history{
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		image{
			width: 150rpx;
			// padding-top: 140rpx;
			box-sizing: border-box;
			margin-top: 20rpx;
		}
		
		text{
			margin: 20rpx;
			font-size: 30rpx;
		}
		.loseData{
			image{
				width: 350rpx;
			}
		}
	}

</style>
